﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace urBook.Gui
{
	/// <summary>
	/// Interaction logic for TabHeader.xaml
	/// </summary>
	public partial class TabHeader : UserControl
	{
        public TabItem parent { get; set; }
        public TabControl root { get; set; }

		public TabHeader(TabControl root, TabItem parent)
		{
			this.InitializeComponent();
            this.root = root;
            this.parent = parent;
		}

        private void closeButton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            ContactView cv = (ContactView)parent.Content;
            if(cv.WindowClosing())
                root.Items.Remove(parent);
        }
	}
}